import {del, get, post, put} from '@/request/methods'
import type {addPost, updateGoods} from "@/request/types/posts";

//获取全部帖子
export function getUserPost() {
    return get('/post/getUserPost')
}

//获取全部帖子
export function getPostByPostId(id: number) {
    return get('/post/getPost',{postId: id})
}

//添加帖子
export function insPost(params: addPost) {
    return post('/post/insPost', params)
}

export function updateGoods(params: updateGoods) {
    return put('/goods/updateGoods', params)
}

export function deleteGoods(params: number){
    return del('/goods/deleteGoods/'+params)
}

//日榜
export function selectPostToDay(){
    return get('/post/selectPostToDay')
}

//周榜
export function selectPostToWeek(){
    return get('/post/selectPostToWeek')
}

//月榜
export function selectPostToMonth(){
    return get('/post/selectPostToMonth')
}

//热点推荐
export function selectPostByLikeCountDesc(){
    return get('/post/selectPostByLikeCountDesc')
}

//搜索
export function selectPostsByName(params: any){
    return get('/post/selectPostsByName',  {name: params} )
}